package com.aw.guiguzi.net.services;

import com.aw.baselib.base.AwResponseBean;
import com.aw.guiguzi.bean.AllTokenResultBean;
import com.aw.guiguzi.bean.BasePageRspBean;
import com.aw.guiguzi.bean.FileItemBean;
import com.aw.guiguzi.bean.LoginRecordItemBean;
import com.aw.guiguzi.bean.LoginResultBean;
import com.aw.guiguzi.bean.MsgItemBean;
import com.aw.guiguzi.bean.MsgTemplateItemBean;
import com.aw.guiguzi.bean.UserInfoBean;
import com.aw.guiguzi.constants.UrlConstant;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 * @author : hzw
 */
public interface INetService {

    @POST(UrlConstant.API_LOGIN)
    Observable<AwResponseBean<LoginResultBean>> login(@Body RequestBody body);

    @Headers("Tenant-Id:1")
    @POST(UrlConstant.API_USER_CREATE)
    Observable<AwResponseBean<String>> createUser(@Body RequestBody body);

    @POST(UrlConstant.API_USER_ROLE_ASSIGN)
    Observable<AwResponseBean<Boolean>> userRoleAssign(@Body RequestBody body);

    @GET(UrlConstant.API_USER_INFO_GET)
    Observable<AwResponseBean<UserInfoBean>> getUserInfo();

    @GET(UrlConstant.API_USER_DETAIL_GET)
    Observable<AwResponseBean<UserInfoBean>> getUserDetail(@Query("id") String id);

    @PUT(UrlConstant.API_USER_INFO_UPDATE)
    Observable<AwResponseBean<Boolean>> updateUserInfo(@Body RequestBody body);

    @PUT(UrlConstant.API_USER_UPDATE_PWD)
    Observable<AwResponseBean<Boolean>> updatePwd(@Body RequestBody body);

    @PUT(UrlConstant.API_USER_UPDATE_STATUS)
    Observable<AwResponseBean<Boolean>> updateStatus(@Body RequestBody body);

    @GET(UrlConstant.API_TOKEN_OTHER_GET)
    Observable<AwResponseBean<AllTokenResultBean>> getAllDeviceToken(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize, @Query("userId") String userId);

    @DELETE(UrlConstant.API_TOKEN_OTHER_DEL)
    Observable<AwResponseBean<Boolean>> delToken(@Query("accessToken") String accessToken);

    @DELETE(UrlConstant.API_USER_DEL)
    Observable<AwResponseBean<Boolean>> delUser(@Query("id") String id);

    @Multipart
    @POST(UrlConstant.API_FILE_UPLOAD)
    Observable<AwResponseBean> upload(@Part MultipartBody.Part file);

    @GET(UrlConstant.API_GET_USER_LIST)
    Observable<AwResponseBean<BasePageRspBean<UserInfoBean>>> getUserList(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize);

    @GET(UrlConstant.API_GET_USER_LIST_SIMPLE)
    Observable<AwResponseBean<List<UserInfoBean>>> getUserListSimple();

    @PUT(UrlConstant.API_USER_REEST_PWD)
    Observable<AwResponseBean<Boolean>> resetPwd(@Body RequestBody body);

    @GET(UrlConstant.API_FILE_LIST)
    Observable<AwResponseBean<BasePageRspBean<FileItemBean>>> getFileList(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize);

    @DELETE(UrlConstant.API_FILE_DEL)
    Observable<AwResponseBean<Boolean>> delFile(@Query("id") String id);

    @GET(UrlConstant.API_LOGIN_RECORD_LIST)
    Observable<AwResponseBean<BasePageRspBean<LoginRecordItemBean>>> getLoginRecordList(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize, @Query("username") String username, @Query("createTime") String[] createTime);

    @GET(UrlConstant.API_LOGIN_RECORD_LIST)
    Observable<AwResponseBean<BasePageRspBean<LoginRecordItemBean>>> getLoginRecordList(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize, @Query("username") String username);

    @GET(UrlConstant.API_MSG_LIST)
    Observable<AwResponseBean<BasePageRspBean<MsgItemBean>>> getMsgList(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize);

    @GET(UrlConstant.API_MSG_LIST)
    Observable<AwResponseBean<BasePageRspBean<MsgItemBean>>> getMsgList(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize, @Query("readStatus") boolean readStatus);

    @PUT(UrlConstant.API_MSG_READ_ALL)
    Observable<AwResponseBean<Boolean>> msgReadAll();

    @PUT(UrlConstant.API_MSG_READ)
    Observable<AwResponseBean<Boolean>> msgRead(@Query("ids") String[] ids);

    @GET(UrlConstant.API_MSG_LIST_MANAGER)
    Observable<AwResponseBean<BasePageRspBean<MsgItemBean>>> getMsgListManager(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize);

    @GET(UrlConstant.API_MSG_UNREAD_COUNT)
    Observable<AwResponseBean<String>> getMsgUnreadCount();

    @POST(UrlConstant.API_MSG_CREATE)
    Observable<AwResponseBean<String>> msgCreateToSend(@Body RequestBody body);

    @GET(UrlConstant.API_MSG_TEMPLATE_LIST)
    Observable<AwResponseBean<BasePageRspBean<MsgTemplateItemBean>>> getMsgTemplateList(@Query("pageNo") int pageNo, @Query("pageSize") int pageSize);
}
